SIEVE cache
This is an implementation of the SIEVE cache replacement algorithm for Rust.
SIEVE is an eviction algorithm simpler than LRU that achieves state-of-the-art efficiency on skewed workloads.
This implementation exposes the same API as the clock-pro
and arc-cache
crates, so it can be used as a drop-in replacement for them in existing applications.
Usage example
use SieveCache;
// Create a new cache with a capacity of 100000.
let mut cache: = new.unwrap;
// Insert key/value pairs into the cache.
cache.insert;
cache.insert;
// Remove an entry from the cache.
cache.remove;
// Retrieve a value from the cache, returning `None` or a reference to the value.
assert_eq!;
// Check if a key is in the cache.
assert_eq!;
// Get a mutable reference to a value in the cache.
if let Some = cache.get_mut
// Return the number of cached values.
assert_eq!;
// Return the capacity of the cache.
assert_eq!;